package cn.barudisshu.log;

import cn.barudisshu.log.provider.JdkLoggerProvider;
import cn.barudisshu.log.provider.LoggerProvider;
import cn.barudisshu.log.provider.Slf4jLoggerProvider;

/**
 * @author Barudisshu
 */
public abstract class Logger {

    private static LoggerProvider loggerProvider;

    static {
        try {
            Class.forName("org.slf4j.Logger");
            loggerProvider = new Slf4jLoggerProvider();
        } catch (ClassNotFoundException e) {
            loggerProvider = new JdkLoggerProvider();
        }
    }

    public static Logger getLogger(Class clazz) {
        return loggerProvider.getLogger(clazz);
    }

    public static Logger getLogger(String clazzName) {
        return loggerProvider.getLogger(clazzName);
    }

    public abstract void debug(String message);

    public abstract void debug(String format, Object... args);

    public abstract void debug(String message, Throwable t);

    public abstract void debug(String format, Throwable t, Object... args);

    public abstract void info(String message);

    public abstract void info(String format, Object... args);

    public abstract void info(String message, Throwable t);

    public abstract void info(String format, Throwable t, Object... args);

    public abstract void warn(String message);

    public abstract void warn(String format, Object... args);

    public abstract void warn(String message, Throwable t);

    public abstract void warn(String format, Throwable t, Object... args);

    public abstract void error(String message);

    public abstract void error(String format, Object... args);

    public abstract void error(String message, Throwable t);

    public abstract void error(String format, Throwable t, Object... args);

    public abstract boolean isDebugEnabled();

    public abstract boolean isInfoEnabled();

    public abstract boolean isWarnEnabled();

    public abstract boolean isErrorEnabled();
}
